
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <include file="./Public/Admin/header.html" />
</head>
<body>
<div id="main">
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="box">
                    <div class="box-title">
                        <div class="span4">
                            <h3><i class="icon-table"></i>用户管理</h3>
                        </div>
                        <div class="btn-group pull-right clearfix ">
                            <!--<form action="{:U('Admin/Permission/users')}" method="get" class="form-horizontal" style="margin: 0px;">
                                <input type="text" id="keyword" name="keyword" value="<?php echo $keyword;?>" class="input-small-z" placeholder="请输入关键词" data-rule-required="true" />

                                <button class="btn" id="btn_search">查询</button>
                            </form>-->
                        </div>
                    </div>
                    <div class="box-content">
                        <div class="row-fluid">
                            <div class="span12 control-group">
                                <div class="span4">
                                    <a class="btn" href="{:U('Admin/Permission/addusers')}?action=add"><i class="icon-plus"></i>添加管理员</a>

                                    <a class="btn" href="javascript:location.reload()"><i class="icon-refresh"></i>刷新</a>
                                </div>
                                <div class="pull-left datatabletool" >
                                    <!--<button class="btn" title="批量解冻" attr='changestatus_0'><i class="icon-unlock"></i>批量解冻</button>
                                    <button class="btn" title="批量冻结"  attr='changestatus_1'><i class="icon-lock"></i>批量冻结</button>-->
                                    <!-- <button class="btn" title="批量删除" attr='BatchDel'><i class="icon-remove"></i>批量删除</button> -->
                                </div>
                            </div>

                        </div>

                        <div class="row-fluid dataTables_wrapper">
                            <table id="listTable" class="table table-bordered table-hover  dataTable">
                                <thead>
                                <tr>
                                    <!--<th class='with-checkbox'><input type="checkbox" class="check_all" /></th>-->
                                    <th>用户名</th>
                                    <th>昵称</th>
                                    <th>角色</th>
                                    <th>手机号码</th>
                                    <th>邮箱</th>
                                    <th>QQ</th>
                                    <th>添加时间</th>
                                    <!--<th>最后登录时间</th>-->
                                    <!--<th>状态</th>-->
                                    <!--<th>操作权限</th>-->
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                <?php foreach($infolist as $item):?>
                                <tr>
                                    <!--<td class="with-checkbox">
                                        <input type="checkbox" name="check" value="<?php echo $item['userid'];?>">
                                    </td>-->
                                    <td style="text-align:left;">
                                        <?php echo $item['username'];?>
                                    </td>
                                    <td><?php echo $item['usernickname'];?></td>
                                    <td><?php echo $item['user_type']['user_type_name'];?></td>
                                    <td><?php echo $item['usermobile'];?></td>
                                    <td><?php echo $item['useremail'];?></td>
                                    <td><?php echo $item['userqq'];?></td>
                                    <td><?php echo $item['addtime'];?></td>
                                    <!--<td><?php echo $item['lastlogintime'];?></td>-->
                                    <!--<td>
                                        <?php if($item['userstatus']==0){?>
                                        <span class="label label-satgreen">正常</span>
                                        <?php }else if($item['userstatus']==1){?>
                                        <span class="label label-important">停用</span>
                                        <?php }?>
                                    </td>-->
                                    <!--<td>
                                        <?php if($item->operation==0){?>
                                        <span class="label label-important">无</span>
                                        <?php }else if($item->operation==1){?>
                                        <span class="label label-satgreen">有</span>
                                        <?php }?>
                                    </td>-->
                                    <td class='hidden-480'>
                                        <?php if($item['username']!='admin'):?>
                                        <a href="#" style="display:none;" class="btn" rel="tooltip" title="View"><i class="icon-search"></i></a>
                                        <a href="{:U('Admin/Permission/addusers')}?action=edit&userid=<?php echo $item['userid'];?>" class="btn" rel="tooltip" title="编辑"><i class="icon-edit"></i>编辑</a>
                                        <a href="javascript:void(0);" class="btn" rel="tooltip" title="删除" attr="deltext_<?php echo $item['comid'];?>_<?php echo $item['userid'];?>"><i class="icon-remove"></i>删除</a>
                                        <?php endif;?>
                                    </td>
                                </tr>
                                <?php endforeach;?>
                                <if condition="($count eq 0) ">
                                    <tr><td align="center" colspan="11">暂无记录</td></tr>
                                </if>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="span4">
                                    <div class="dataTables_info">
                                        <if condition="($count gt 0) ">
                                            共{$count}条记录，当前第{$nowPage}/{$totalPages}页
                                        </if>
                                    </div>
                                </div>
                                <div class="span">
                                    {$page}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script type="text/javascript">
    function a(){
        $("#myModal2").modal("show");
    }
    $(function () {
        $("tr").delegate(".pay", "click", function () {
            //$("#price").val("100");
            //$("#codeid").val($(this).attr("data-codeid"));
            $("#myModal2").modal("show");
        });
    });
</script>
<script type="text/javascript">
    $(function(){
        var delText = function(event){
            G.ui.tips.confirm_flag('您确定要删除吗?',function(){
                $.post("{:U('Admin/Permission/delsysuser')}", {aid:event.data.aid, tid:event.data.tid},function(data){
                    if (data.errno ==0)
                    {
                        location.reload();
                    } else {
                        G.ui.tips.err(data.error);
                    }
                },'json');
            });
        };

        $("a[attr^='deltext_']").each(function(){
            var tmp = $(this).attr('attr').split('_');
            $(this).bind("click", {aid:tmp[1], tid:tmp[2]}, delText);
        });

        var changeStatus=function(event){
            var check = $("input:checked").not($(".check_all")[0]);
            if(check.length<1){
                alert('请选择删除项');
                return false;
            }
            var id = new Array();
            check.each(function(i){
                id[i] = $(this).val();
            });
            $.post("{:U('Admin/Permission/changestatus')}", {status:event.data.status, tid:id},function(data){
                if (data.errno ==0)
                {
                    location.reload();
                } else {
                    G.ui.tips.err(data.error);
                }
            },'json');
        };
        $("button[attr^='changestatus_']").each(function(){
            var tmp = $(this).attr('attr').split('_');
            $(this).bind("click", {status:tmp[1]}, changeStatus);
        });


        $("[attr='BatchDel']").click(function(){
            var check = $("input:checked").not($(".check_all")[0]);
            if(check.length<1){
                alert('请选择删除项');
                return false;
            }
            G.ui.tips.confirm_flag('您确定要删除吗?',function(){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                $.post("{:U('Admin/Permission/delsysuser')}", {tid:id, aid:$('#comid').val()},function(data){
                    if (data.errno ==0)
                    {
                        location.reload();
                    } else {
                        G.ui.tips.err(data.error);
                        //alert(data.error);
                    }
                },'json');
            });
        });
        $("#btn_search").click(function(){
            var keywords = $.trim($('#keyword').val());
            if (keywords.length <= 0) {
                //alert('请输入搜索关键字.');
                //$('#keyword').focus();
                //return false;
            }
            //window.location.href = '/wechat/replytext/aid/'+$('#aid').val()+'/type/'+$('#select_type').val()+'/keywords/' + keywords;

        });
        $("#keyword").keyup(function(e) {
            if (e.keyCode == 13) {
                $("#btn_search").click();
                return false;
            }
        });
    });
</script>
</body>
</html>
